Add Concurrent Merge Sort Implementation - #7544
Merged
DenizAltunkapan merged 8 commits intoJul 31, 2026
Merged
Conversation
anshullakra007
requested review from
DenizAltunkapan,
alxkm and
yanglbme
as code owners
July 26, 2026 16:13
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7544 +/- ##
============================================
+ Coverage 80.40% 80.42% +0.02%
- Complexity 7444 7454 +10
============================================
Files 814 815 +1
Lines 24016 24053 +37
Branches 4727 4731 +4
============================================
+ Hits 19309 19345 +36
+ Misses 3945 3944 -1
- Partials 762 764 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
anshullakra007
force-pushed
the
feat/concurrent-merge-sort
branch
from
July 26, 2026 16:47
10d265c to
fc8ab59
Compare
Contributor
Author
|
Hi maintainers! 👋 Just a friendly follow-up on this PR. All CI checks are passing, and I've addressed the previous feedback. Whenever someone has time, I'd really appreciate a review. Thank you for your time! |
DenizAltunkapan
approved these changes
Jul 31, 2026
DenizAltunkapan
left a comment
Member
There was a problem hiding this comment.
@anshullakra007 thank you for the contribution
DenizAltunkapan
enabled auto-merge (squash)
July 31, 2026 11:11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add Concurrent Merge Sort Implementation
Description
This PR introduces a
ConcurrentMergeSortalgorithm that accelerates the standard divide-and-conquer Merge Sort by distributing sub-array sorting tasks across multiple threads utilizing aThreadPoolExecutor.To prevent the overhead of thread creation and context switching from ruining overall performance, this implementation incorporates a sequential fallback threshold (set to 8,192 elements). Once a sub-array's size drops below this threshold—or when a safe maximum concurrency depth is reached—the algorithm smartly switches to a standard sequential Merge Sort. This design prevents thread starvation deadlocks and ensures optimal CPU resource utilization.
Time & Space Complexity
Testing
Comprehensive and strictly deterministic JUnit 5 tests have been added in
ConcurrentMergeSortTest.javato guarantee reliability:[]) and single-element ([42]) arrays.Random(42)seed for CI determinism) to intentionally exceed the 8,192 sequential threshold, verifying the multithreaded pathways against Java's heavily optimized built-inArrays.sort().Checklist
finallyblock, preventing CI/CD pipeline hangs.